package cn.edu.nju.software.cdiy.bean;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

public class Radiator extends Hardware implements Comparable<Radiator>,
		Serializable {

	private static final long serialVersionUID = 7084084264660643642L;
	private int id;
	// 型号1
	private String model;// 散热器型号

	// 外键品牌表1
	private BRD_RAD brand;// 散热器品牌

	// 外键码表4
	private Value type;// 散热器类型
	private Value bearingType;// 轴承类型
	private Value RGMaterial;// 热管材质
	private Value heatEmissionFinMaterial;// 散热片材质

	// 一对多关系
	private Set<RAD_Way> radwSet;// 散热方式
	private Set<RAD_CompatibleCPU> rccpuSet;// 支持CPU类型

	// 次要指标15
	private int highestSpeed;// 最高转速
	private String speedDescription;// 转速描述
	private double noise;// 噪音
	private int RGNUM;// 热管数量
	private String rSize;// 产品尺寸
	private double rWeight;// 产品重量
	private int intelligentTemControl;// 智能控温技术
	private String powerParameter;// 电源参数
	private String CSPhone;// 客服电话
	private String qualityPolicy;// 质保政策
	private String qualityTime;// 质保时间
	private String qualityContent;// 质保详细内容
	private String attachment;// 附件

	// 管理类参数6
	private int iPrice;// 入库价格
	private int oPrice;// 出库价格
	private double performance;// 性能
	private Date inStorageTime;// 入库时间
	private String imgPath;// 图片路径
	private Value state;// 状态 //外键；{0:审核中 1:已通过}
	private double wScore;// 网友评分
	private double zScore;// 专家评分
	private int supplier;// 供货商

	private int sale;// 销售量
	private String rsv2;// 预留信息
	private String rsv3;// 预留信息

	public Set<RAD_Way> getRadwSet() {
		return radwSet;
	}

	public void setRadwSet(Set<RAD_Way> radwSet) {
		this.radwSet = radwSet;
	}

	public Set<RAD_CompatibleCPU> getRccpuSet() {
		return rccpuSet;
	}

	public void setRccpuSet(Set<RAD_CompatibleCPU> rccpuSet) {
		this.rccpuSet = rccpuSet;
	}

	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public BRD_RAD getBrand() {
		return brand;
	}

	public void setBrand(BRD_RAD brand) {
		this.brand = brand;
	}

	public Value getType() {
		return type;
	}

	public void setType(Value type) {
		this.type = type;
	}

	public Value getBearingType() {
		return bearingType;
	}

	public void setBearingType(Value bearingType) {
		this.bearingType = bearingType;
	}

	public Value getRGMaterial() {
		return RGMaterial;
	}

	public void setRGMaterial(Value rGMaterial) {
		RGMaterial = rGMaterial;
	}

	public Value getHeatEmissionFinMaterial() {
		return heatEmissionFinMaterial;
	}

	public void setHeatEmissionFinMaterial(Value heatEmissionFinMaterial) {
		this.heatEmissionFinMaterial = heatEmissionFinMaterial;
	}

	public int getHighestSpeed() {
		return highestSpeed;
	}

	public void setHighestSpeed(int highestSpeed) {
		this.highestSpeed = highestSpeed;
	}

	public String getSpeedDescription() {
		return speedDescription;
	}

	public void setSpeedDescription(String speedDescription) {
		this.speedDescription = speedDescription;
	}

	public double getNoise() {
		return noise;
	}

	public void setNoise(double noise) {
		this.noise = noise;
	}

	public int getRGNUM() {
		return RGNUM;
	}

	public void setRGNUM(int rGNUM) {
		RGNUM = rGNUM;
	}

	public String getrSize() {
		return rSize;
	}

	public void setrSize(String rSize) {
		this.rSize = rSize;
	}

	public double getrWeight() {
		return rWeight;
	}

	public void setrWeight(double rWeight) {
		this.rWeight = rWeight;
	}

	public int getIntelligentTemControl() {
		return intelligentTemControl;
	}

	public void setIntelligentTemControl(int intelligentTemControl) {
		this.intelligentTemControl = intelligentTemControl;
	}

	public String getPowerParameter() {
		return powerParameter;
	}

	public void setPowerParameter(String powerParameter) {
		this.powerParameter = powerParameter;
	}

	public String getCSPhone() {
		return CSPhone;
	}

	public void setCSPhone(String cSPhone) {
		CSPhone = cSPhone;
	}

	public String getQualityPolicy() {
		return qualityPolicy;
	}

	public void setQualityPolicy(String qualityPolicy) {
		this.qualityPolicy = qualityPolicy;
	}

	public String getQualityTime() {
		return qualityTime;
	}

	public void setQualityTime(String qualityTime) {
		this.qualityTime = qualityTime;
	}

	public String getQualityContent() {
		return qualityContent;
	}

	public void setQualityContent(String qualityContent) {
		this.qualityContent = qualityContent;
	}

	public String getAttachment() {
		return attachment;
	}

	public void setAttachment(String attachment) {
		this.attachment = attachment;
	}

	public int getiPrice() {
		return iPrice;
	}

	public void setiPrice(int iPrice) {
		this.iPrice = iPrice;
	}

	public int getoPrice() {
		return oPrice;
	}

	public void setoPrice(int oPrice) {
		this.oPrice = oPrice;
	}

	public double getPerformance() {
		return performance;
	}

	public void setPerformance(double performance) {
		this.performance = performance;
	}

	public Date getInStorageTime() {
		return inStorageTime;
	}

	public void setInStorageTime(Date inStorageTime) {
		this.inStorageTime = inStorageTime;
	}

	public String getImgPath() {
		return imgPath;
	}

	public void setImgPath(String imgPath) {
		this.imgPath = imgPath;
	}

	public Value getState() {
		return state;
	}

	public void setState(Value state) {
		this.state = state;
	}

	public double getwScore() {
		return wScore;
	}

	public void setwScore(double wScore) {
		this.wScore = wScore;
	}

	public double getzScore() {
		return zScore;
	}

	public void setzScore(double zScore) {
		this.zScore = zScore;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getSupplier() {
		return supplier;
	}

	public void setSupplier(int supplier) {
		this.supplier = supplier;
	}

	public int getSale() {
		return sale;
	}

	public void setSale(int sale) {
		this.sale = sale;
	}

	public String getRsv2() {
		return rsv2;
	}

	public void setRsv2(String rsv2) {
		this.rsv2 = rsv2;
	}

	public String getRsv3() {
		return rsv3;
	}

	public void setRsv3(String rsv3) {
		this.rsv3 = rsv3;
	}

	@Override
	public int compareTo(Radiator o) {

		Date now = new Date();

		// this的热度
		long gap = now.getTime() - inStorageTime.getTime();
		int gapDay = (int) (gap / (24 * 3600 * 1000));

		double nowHot = sale / gapDay;

		// 参数的hot
		long oGap = now.getTime() - o.getInStorageTime().getTime();
		int oGapDay = (int) (oGap / (24 * 3600 * 1000)) + 1;

		double oHot = o.getSale() / oGapDay;

		// 降序排列
		if (nowHot > oHot)
			return -1;
		else if (nowHot == oHot)
			return 0;
		else
			return 1;
	}

}
